package io.gitee.wiqer.simple;

import java.util.Stack;

public class SolutionNC76_Queue {
    Stack<Integer> stack1 = new Stack<Integer>();
    Stack<Integer> stack2 = new Stack<Integer>();
    int pushIndex=0;
    public void push(int node) {
        if((pushIndex++&1)==0){
            stack1.push(node);
        }else{
            stack2.push(node);
        }
    }
    int popIndex=0;
    public int pop() {
        if((popIndex++&1)==0){
            try {
                return  stack1.elementAt(0);
            }finally {
                stack1.remove(0);
            }

        }else{
            try {
                return stack2.peek();
            }finally {
                stack2.remove(0);
            }

        }
    }
}
